<template>
	<div>
		<!--<el-tabs v-model="activeName" @tab-click="handleClick">-->

			<!---------------------问题项----------------------------->

			<!--<el-tab-pane label="问题" name="first">-->
				<!--查询部分-->
				<el-row>
					<el-col :span="1" style="margin-left: 250px;">
						<p class="queryLabel">编号名称：</p>
					</el-col>
					<el-col :span="3" style="padding-left: 10px;">
						<el-input v-model="queryData.itemCode" size="small" placeholder="请输入编号"></el-input>
					</el-col>
					<el-col :span="1" style="padding-left: 10px;">
						<el-button size="small" type="primary" @click="queryButton">查 询</el-button>
					</el-col>
					<el-col :span="1" style="margin-left: 400px;">
						<el-button size="small" type="primary" @click="addButton">新 增</el-button>
					</el-col>
					<el-col :span="1" style="padding-left: 10px;">
						<el-button size="small" type="primary" @click="editButton">编 辑</el-button>
					</el-col>
					<el-col :span="1" style="padding-left: 10px;">
						<el-button size="small" type="primary" @click="startButton">启 用</el-button>
					</el-col>
					<el-col :span="1" style="padding-left: 10px;">
						<el-button size="small" type="primary" @click="stopButton">停 用</el-button>
					</el-col>
				</el-row>

				<!--表格部分-->
				<el-row>
					<el-col :span="4">
						<el-table :data="tableDataTree.dataList" border @selection-change="handleSelectionChange" @cell-click="queryItemButton" highlight-current-row>
							<!--ref="singleTable"-->
							<el-table-column prop="groupName" label="分类名称" width="220"></el-table-column>
						</el-table>
					</el-col>

					<el-col :span="18" style="margin-left: 20px;">
						<el-table :data="tableData.dataList" stripe border @selection-change="handleSelectionChange" @row-dblclick="dbClickButton">
							<el-table-column type="selection" width="50" fixed>
							</el-table-column>
							<el-table-column prop="itemCode" label="问题编号" width="220"></el-table-column>
							<el-table-column prop="itemName" label="问题名称" width="220"></el-table-column>
							<el-table-column prop="dispOrder" label="显示顺序" width="220"></el-table-column>
							<el-table-column label="类型" width="220" :formatter="itemTypeCov"></el-table-column>
							<el-table-column label="状态" width="220" :formatter="statusCov"></el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" @current-page="CurentPageMj" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total,prev, pager, next" :total="tableData.total"></el-pagination>

					</el-col>
				</el-row>

				<el-dialog title="新增问题项" v-model="addDialogShow" size="tiny">


					<el-form :model="editData" :rules="rules" ref="editData" label-width="100px" class="demo-ruleForm">


						<el-form-item label="分类名称" prop="groupName">
							<el-input v-model="editData.groupName" type="" size="small" placeholder="分类名称" disabled="true"></el-input>
						</el-form-item>
						
						<el-form-item label="项编码" prop="itemCode">
							<el-input v-model="editData.itemCode" size="small" placeholder="项编码"></el-input>
						</el-form-item>
						
						<el-form-item label="项名称" prop="itemName">
							<el-input v-model="editData.itemName" type="" size="small" placeholder="项名称"></el-input>
						</el-form-item>
						
						<el-form-item label="类型" prop="itemType">
							<el-select size="small" v-model="editData.itemType" placeholder="请选择">
								<el-option v-for="item in countTypeCombo" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
						
						<el-form-item label="显示顺序" prop="dispOrder">
							<el-input v-model="editData.dispOrder" type="number" size="small" placeholder="显示顺序"></el-input>
						</el-form-item>
					</el-form>

					<el-row>
						<el-col :span="12">
							<el-button type="primary" size="small" style="margin-left: 100px;" @click="addSubmit('editData')">提 交</el-button>
						</el-col>
						<el-col :span="12">
							<el-button type="primary" size="small" style="margin-left: 70px;" @click="addCansel">取 消</el-button>
						</el-col>
					</el-row>
				</el-dialog>

				<el-dialog title="编辑" v-model="editDialogShow" size="tiny">

					<el-form :model="editData" :rules="rules" ref="editData" label-width="100px" class="demo-ruleForm">


						<el-form-item label="分类名称" prop="groupName">
							<el-input v-model="editData.groupName" type="" size="small" placeholder="分类名称" disabled="true"></el-input>
						</el-form-item>
						
						<el-form-item label="项编码" prop="itemCode">
							<el-input v-model="editData.itemCode" size="small" placeholder="项编码"></el-input>
						</el-form-item>
						
						<el-form-item label="项名称" prop="itemName">
							<el-input v-model="editData.itemName" type="" size="small" placeholder="项名称"></el-input>
						</el-form-item>
						
						<el-form-item label="类型" prop="itemType">
							<el-select size="small" v-model="editData.itemType" placeholder="请选择">
								<el-option v-for="item in countTypeCombo" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</el-form-item>
						
						<el-form-item label="显示顺序" prop="dispOrder">
							<el-input v-model="editData.dispOrder" type="number" size="small" placeholder="显示顺序"></el-input>
						</el-form-item>
					</el-form>

					<el-row>
						<el-col :span="12">
							<el-button type="primary" size="small" style="margin-left: 100px;" @click="editSubmit('editData')">提 交</el-button>
						</el-col>
						<el-col :span="12">
							<el-button type="primary" size="small" style="margin-left: 70px;" @click="editCansel">取 消</el-button>
						</el-col>
					</el-row>
				</el-dialog>

			<!--</el-tab-pane>-->

			<!---------------------问题项----------------------------->

	<div v-if="activeName == 'second'">
		
		<el-row>

					<el-col :span="3" style="margin-left: 10px;">
						<p>
							<font style="font-size: larger;" color="#999999">当前问题名称：</font>

						</p>
						<p>
							<font style="font-size: larger;" color="#11B95C">{{QitemName}}</font>
						</p>

					</el-col>

					<el-col :span="1" style="margin-left: 280px;">
						<el-button size="small" type="primary" @click="QaddButton">新 增</el-button>
					</el-col>
					<el-col :span="1" style="padding-left: 10px;">
						<el-button size="small" type="primary" @click="QdeleteButton">删 除</el-button>
					</el-col>
					<el-col :span="1" style="padding-left: 10px;">
						<el-button size="small" type="primary" @click="QstartButton">启 用</el-button>
					</el-col>
					<el-col :span="1" style="padding-left: 10px;">
						<el-button size="small" type="primary" @click="QstopButton">停 用</el-button>
					</el-col>

					<el-col :span="1" style="padding-left: 50px;">
						<el-button type="primary" size="small" @click="backBtton">返 回</el-button>
					</el-col>
				</el-row>

				<!--表格部分-->
				<el-row :gutter="24">

					<el-col :span="14" style="margin-left: 10px;">
						<el-table :data="QtableData.dataList" stripe border @selection-change="handleSelectionChange2" @cell-click="QqueryItemButton">
							<el-table-column type="selection" width="50">
							</el-table-column>
							<el-table-column prop="areaCode" label="区间编号" width="220"></el-table-column>
							<el-table-column prop="areaName" label="区间名称" width="250"></el-table-column>
							<el-table-column label="状态" width="220" :formatter="statusCov"></el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange2" @current-change="handleCurrentChange2" @current-page="CurentPage2" :page-sizes="page2.pageSizes" :page-size="page2.pageSize" layout="total,prev, pager, next" :total="QtableData.total"></el-pagination>

					</el-col>
				</el-row>

				<el-dialog title="评分区间" v-model="QaddDialogShow" size="tiny">


					<el-form :model="QeditData" :rules="rules2" ref="QeditData" label-width="100px" class="demo-ruleForm">
					  <el-form-item label="分类名称" prop="groupName">
					    <el-input v-model="QeditData.groupName" type="" size="small" placeholder="分类名称" disabled="true"></el-input>
					  </el-form-item>
					  
					  <el-form-item label="问题名称" prop="itemName">
					   <el-input v-model="QeditData.itemName" type="" size="small" placeholder="问题名称" disabled="true"></el-input>
					  </el-form-item>
					  
					  <el-form-item label="区间编号" prop="areaCode">
					    <el-input v-model="QeditData.areaCode" type="" size="small" placeholder="区间编号"></el-input>
					  </el-form-item>
					  
					  <el-form-item label="区间名称" prop="areaName">
					    <el-input v-model="QeditData.areaName" type="" size="small" placeholder="区间名称"></el-input>
					  </el-form-item>
					
					</el-form>
					<el-row>
						<el-col :span="12">
							<el-button type="primary" size="small" style="margin-left: 100px;" @click="QaddSubmit('QeditData')">提 交</el-button>
						</el-col>
						<el-col :span="12">
							<el-button type="primary" size="small" style="margin-left: 70px;" @click="QaddCansel">取 消</el-button>
						</el-col>
					</el-row>
				</el-dialog>
		
	</div>

			<!--<el-tab-pane label="问题项" name="second">-->

				

			<!--</el-tab-pane>
		</el-tabs>-->

	</div>

</template>

<script>
	export default {
		data: function() {
			return {

				// 规则
				rules: {
					itemCode: [{
							required: true,
							message: '请输入项编码',
							trigger: 'blur'
						}

					],
					itemName: [{
							required: true,
							message: '请输入项名称',
							trigger: 'blur'
						}

					],
					dispOrder: [{
							required: true,
							message: '请输入显示顺序',
							trigger: 'blur'
						}

					],
					itemType: [{
						required: true,
						message: '请输入类型',
						trigger: 'blur'
					}],
				},
				// 问题项规则
				rules2: {
					/*groupName: [{
							required: true,
							message: '请输入分类名称',
							trigger: 'blur'
						}

					],
					itemName: [{
							required: true,
							message: '请输入问题名称',
							trigger: 'blur'
						}

					],*/
					areaCode: [{
							required: true,
							message: '请输入区间编号',
							trigger: 'blur'
						}

					],
					areaName: [{
						required: true,
						message: '请输入区间名称',
						trigger: 'blur'
					}],
				},

				activeName: 'first',
				//临时变量
				rowId: "",
				itemCode: "",
				groupCode: "",
				groupName: "",
				// 评级类型下拉
				scoreTypeCombo: [{
					label: "得分",
					value: "1",
				}, {
					label: "项目",
					value: "2",
				}],
				// 项目名称下拉
				ItemNameCombo: [],
				// 评级方式
				countTypeCombo: [{
						label: "单项",
						value: "dx",
					},
					{
						label: "多项",
						value: "ddx",
					},
					{
						label: "文本",
						value: "wb",
					}
				],
				// 等级下拉框
				levelCodeListCombo: [],
				// 新增dialog显示
				addDialogShow: false,
				//  编辑dialog 显示
				editDialogShow: false,
				// 查询集合
				queryData: {
					itemCode: "",
				},
				CurentPageMj: 1,
				page: this.page,
				CurentPage2: 1,
				page2: this.page,
				// 查询数据
				tableData: {
					total: 0,
					dataList: [],
				},
				// 左侧数查询数据
				tableDataTree: {
					total: 0,
					dataList: [],
				},
				// 修改数据
				editData: {
					groupCode: "",
					groupName: "",
					itemCode: "",
					itemName: "",
					dispOrder: "",
					status: "",
					itemType: "",
					id: "",

				},
				// 修改数据初始化
				emptyEditData: {
					groupCode: "",
					groupName: "",
					itemCode: "",
					itemName: "",
					dispOrder: "",
					status: "",
					itemType: "",
					id: "",
				},
				// 选择数据
				multipleSelection: "",

				/***问题项相关****/
				QgroupCode: "",
				QgroupName: "",
				QitemCode: "",
				QitemName: "",
				QitemId: "",
				// 查询数据
				QtableData: {
					total: 0,
					dataList: [],
				},
				QaddDialogShow: false,
				// 修改数据
				QeditData: {
					groupCode: "",
					groupName: "",
					itemCode: "",
					itemName: "",
					dispOrder: "",
					status: "",
					itemType: "",
					id: "",
					itemId: "",

				},
				// 修改数据初始化
				QemptyEditData: {
					groupCode: "",
					groupName: "",
					itemCode: "",
					itemName: "",
					dispOrder: "",
					status: "",
					itemType: "",
					id: "",
					itemId: "",
				},
				multipleSelection2: "",
			}
		},
		methods: {
			handleClick: function(tab, event) {
				//alert(tab, event);
			},
			QqueryHttp: function(id, itemCode) {
				debugger;
				this.$http.get(this.API_ROOT + '/crm/base/survery/area/page', {
					params: {
						id: id,
						areaCode: itemCode,
						start: this.$data.CurentPage2,
						limit: this.$data.page2.pageSize,
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						this.$data.QtableData.dataList = resp.data.dataList;
						this.$data.QtableData.total = resp.data.total;
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			QqueryItemButton: function() {
				//alert("单击");
			},
			QaddButton: function() {
				this.QeditData.groupCode = this.$data.QgroupCode;
				this.QeditData.itemCode = this.$data.QitemCode;
				this.QeditData.groupName = this.$data.QgroupName;
				this.QeditData.itemName = this.$data.QitemName;
				this.QeditData.itemId = this.$data.QitemId;

				this.QeditData.areaCode = ""; // 输入框置空
				this.QeditData.areaName = ""; // 输入框置空

				this.$data.QaddDialogShow = true;
			},
			QdeleteButton: function() {
				debugger;
				//var tempId = this.$data.rowId;
				if(this.$data.multipleSelection2.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}
				this.$http.get(this.API_ROOT + '/crm/base/survery/area/impDel', {
					params: {
						id: this.$data.multipleSelection2[0].id,
					}
				}).then(resp => {
					if(resp.data.success) {
						this.$message("删除成功！");
						this.QqueryHttp("", this.$data.QitemCode);
					} else {
						this.$message.error(resp.data.msg);
					}
					this.$data.QaddDialogShow = false;
				}, resp => {});
			},
			QstartButton: function() {
				if(this.$data.multipleSelection2.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}
				this.$http.get(this.API_ROOT + '/crm/base/survery/area/start', {
					params: {
						id: this.$data.multipleSelection2[0].id,
					}
				}).then(resp => {
					if(resp.data.success) {
						this.$message("启用成功！");
						this.QqueryHttp("", this.$data.QitemCode);
					} else {
						this.$message.error(resp.data.msg);
					}
					this.$data.QaddDialogShow = false;
				}, resp => {});
			},
			QstopButton: function() {
				if(this.$data.multipleSelection2.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}
				this.$http.get(this.API_ROOT + '/crm/base/survery/area/stop', {
					params: {
						id: this.$data.multipleSelection2[0].id,
					}
				}).then(resp => {
					if(resp.data.success) {
						this.$message("停用成功！");
						this.QqueryHttp("", this.$data.QitemCode);
					} else {
						this.$message.error(resp.data.msg);
					}
					this.$data.QaddDialogShow = false;
				}, resp => {});
			},
			QaddSubmit: function(formName) {
				
				this.$refs[formName].validate((valid) => {
		          if (valid) {
				
						debugger;
						this.$http.post(this.API_ROOT + '/crm/base/survery/area/save', this.$data.QeditData,{
							params: {
							/*	areaCode: this.$data.QeditData.areaCode,
								areaName: this.$data.QeditData.areaName,
								groupCode: this.QeditData.groupCode,
								itemCode: this.QeditData.itemCode,
								groupId: "",
								itemId: this.$data.QitemId,
								start: this.$data.CurentPage2,
								limit: this.$data.page2.pageSize,*/
							}
						}).then(resp => {
							if(resp.data.success) {
								resp.data.total = parseInt(resp.data.total);
								this.$message("保存成功！");
								this.$data.QtableData.dataList = resp.data.dataList;
								this.$data.QtableData.total = resp.data.total;
								this.QqueryHttp("", this.$data.QitemCode);
							} else {
								this.$message.error(resp.data.msg);
							}
							this.$data.QaddDialogShow = false;
						}, resp => {});
				
					} else {
		            this.$message.error("表单填写不全！");
		            return false;
		         }
		        });
			},
			QaddCansel: function() {
				this.$data.QaddDialogShow = false;
			},

			// 问题项界面返回
			backBtton: function() {
				this.$data.activeName = "first";
			},
			// 双击进入问题项界面
			dbClickButton: function(row) {
				debugger;
				this.$data.QgroupCode = row.groupCode;
				this.$data.QitemCode = row.itemCode;
				this.$data.QgroupName = row.groupName;
				this.$data.QitemName = row.itemName;
				this.$data.QitemId = row.id;
				this.$data.activeName = "second";
				this.QqueryHttp("", this.$data.QitemCode);
			},
			//选择框
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
			},
			//选择框
			handleSelectionChange2: function(val) {
				debugger;
				this.$data.multipleSelection2 = val;
			},
			// 列表点击
			queryItemButton: function(row) {
				debugger;
				this.$data.rowId = row.id;
				this.$data.itemCode = row.itemCode;
				this.$data.groupCode = row.groupCode;
				this.$data.groupName = row.groupName;
				this.queryMethod(row.id, row.itemCode, row.groupCode); // http查询

			},
			// 查 询 
			queryButton: function() {
				this.$data.rowId = "";
				this.$data.itemCode = "";
				this.$data.groupCode = "";
				debugger;
				this.$data.itemCode = this.$data.queryData.itemCode;

				this.queryMethod(this.$data.rowId, "", this.$data.groupCode); // http查询

			},
			// http查询方法封装
			queryMethod: function(id, itemCode, groupCode) {
				this.$data.tableData.dataList = [];
				//this.$data.tableData.total = 0;
				debugger;
				this.$http.get(this.API_ROOT + '/crm/base/survery/item/page', {
					params: {
						id: id,
						itemCode: itemCode,
						groupCode: groupCode,
						start: this.$data.CurentPageMj,
						limit: this.$data.page.pageSize,
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						this.$data.tableData.dataList = resp.data.dataList;
						this.$data.tableData.total = resp.data.total;
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			// 左侧树查 询 
			queryButton2: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/crm/base/survery/item/leftTree', {
					params: {}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						this.$data.tableDataTree.dataList = resp.data.dataList;
						this.$data.tableDataTree.total = resp.data.total;
					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			// 添加按钮
			addButton: function() {
				debugger;
				this.$data.editData = Object.assign(this.$data.editData, this.$data.emptyEditData);
				//				this.$data.rowId;
				//				this.$data.itemCode;
				//				this.$data.groupCode;
				this.$data.editData.groupName = this.$data.groupName;
				this.$data.addDialogShow = true;
			},

			/**编辑按钮**/
			editButton: function() {
				debugger;
				if(this.$data.multipleSelection.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}
				this.$data.editData = Object.assign(this.$data.editData, this.$data.emptyEditData); //置空表单
				this.getDataById();
				this.$data.editDialogShow = true;
			},
			// 启用
			startButton: function() {
				debugger;
				var tempId = this.$data.rowId;
				//alert("启用");
				if(this.$data.multipleSelection.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}
				this.$http.get(this.API_ROOT + '/crm/base/survery/item/start', {
					params: {
						id: this.$data.multipleSelection[0].id,
					}
				}).then(resp => {
					if(resp.data.success) {
						this.$message(resp.data.msg);
						this.queryMethod(this.$data.rowId, this.$data.itemCode, this.$data.groupCode); // 刷新
						this.$data.multipleSelection = []; // 选择置空
					} else {
						this.$message.error(resp.data.msg);
						this.queryMethod(this.$data.rowId, this.$data.itemCode, this.$data.groupCode); // 刷新
						this.$data.multipleSelection = []; // 选择置空
					}
				}, resp => {});
			},
			// 停用
			stopButton: function() {
				debugger;
				var tempId = this.$data.rowId;
				//alert("停用");
				if(this.$data.multipleSelection.length != 1) {
					this.$message.error("请选择一条数据");
					return;
				}
				this.$http.get(this.API_ROOT + '/crm/base/survery/item/stop', {
					params: {
						id: this.$data.multipleSelection[0].id,
					}
				}).then(resp => {
					if(resp.data.success) {
						this.$message(resp.data.msg);
						this.queryMethod(this.$data.rowId, this.$data.itemCode, this.$data.groupCode); // 刷新
						this.$data.multipleSelection = []; // 选择置空
					} else {
						this.$message.error(resp.data.msg);
						this.queryMethod(this.$data.rowId, this.$data.itemCode, this.$data.groupCode); // 刷新
						this.$data.multipleSelection = []; // 选择置空
					}
				}, resp => {});
			},
			/**【添加】提交**/
			addSubmit: function(formName) {
				
				this.$refs[formName].validate((valid) => {
		          if (valid) {
				
						debugger;
						this.$data.editData.groupCode = this.$data.groupCode;
						this.$http.post(this.API_ROOT + '/crm/base/survery/item/save', this.$data.editData, {
							params: {}
						}).then(resp => {
							if(resp.data.success) {
								this.$data.addDialogShow = false;
								this.$message("保存成功！");
								//this.queryMethod(tempID);
								this.queryMethod(this.$data.rowId, this.$data.itemCode, this.$data.groupCode);
							} else {
								this.$message.error(resp.data.msg);
							}
						}, resp => {});
						
				} else {
		            this.$message.error("表单填写不全！");
		            return false;
		         }
		        });

			},
			/**【添加】取消**/
			addCansel: function() {
				debugger;
				this.$data.addDialogShow = false;
			},

			/** 【编辑】提交 **/
			editSubmit: function(formName) {
				
				this.$refs[formName].validate((valid) => {
		          if (valid) {
				
					debugger;
					this.$data.editData.groupCode = this.$data.groupCode;
					this.$http.post(this.API_ROOT + '/crm/base/survery/item/save', this.$data.editData, {
						params: {}
					}).then(resp => {
						if(resp.data.success) {
							this.$data.editDialogShow = false;
							this.$message("保存成功！");
							this.queryMethod(this.$data.rowId, this.$data.itemCode, this.$data.groupCode);
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
				
				} else {
		            this.$message.error("表单填写不全！");
		            return false;
		         }
		        });

			},
			/**【编辑】 取消**/
			editCansel: function() {
				debugger;
				this.$data.editDialogShow = false;
			},

			//列表分页大小切换
			handleSizeChange: function() {},
			//列表当前页切换
			handleCurrentChange: function(currentPage) {

				debugger;
				this.$data.CurentPageMj = currentPage;
				this.queryMethod(this.$data.rowId);
			},
			//列表分页大小切换
			handleSizeChange2: function() {},
			//列表当前页切换
			handleCurrentChange2: function(currentPage) {

				debugger;
				this.$data.CurentPage2 = currentPage;
				this.QqueryHttp("", this.$data.QitemCode);
			},

			// 状态转换
			statusCov: function(row) {
				switch(row.status) {
					case '0':
						return "未启用";
						break;
					case '1':
						return "已启用";
						break;
					default:
						return "状态未知";
						break;

				}
			},
			// 等级下拉
			levelCombo: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/bc/custome/itemscore/combo', {
					params: {
						//id:this.$data.multipleSelection[0].id,
					}
				}).then(resp => {
					if(resp.data.success) {
						this.$data.ItemNameCombo = resp.data.dataList;
					} else {}
				}, resp => {});
			},
			// 评级值转换
			countValueCov: function(row) {
				debugger;
				if(row.start == "" || row.start == null) {
					if(row.stop == "" || row.stop == null) {
						return "";
					} else {
						return row.stop;
					}
				} else {
					if(row.stop == "" || row.stop == null) {
						return row.start;
					} else {
						return row.start + " , " + row.stop;
					}
				}
			},
			// 编辑获取选中信息
			getDataById: function() {
				debugger;
				this.$http.get(this.API_ROOT + '/crm/base/survery/item/info', {
					params: {
						id: this.$data.multipleSelection[0].id,
					}
				}).then(resp => {
					if(resp.data.success) {
						//this.$message(resp.data.msg);
						this.$data.editData.groupName = resp.data.data.groupName;
						this.$data.editData.groupCode = resp.data.data.groupCode;
						this.$data.editData.itemCode = resp.data.data.itemCode;
						this.$data.editData.itemName = resp.data.data.itemName;
						this.$data.editData.id = resp.data.data.id;
						this.$data.editData.dispOrder = resp.data.data.dispOrder.toString();
						this.$data.editData.status = resp.data.data.status;
						this.$data.editData.itemType = resp.data.data.itemType;
					} else {
						//this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			// 评级类型转换
			scoreTypeCov: function(row) {
				switch(row.scoreType) {
					case "1":
						return "得分";
						break;
					case "2":
						return "项目";
						break;
					default:
						return "未知";
						break;
				}

			},
			//评级方式转换
			countTypeCov: function(row) {
				switch(row.countType) {
					case "zqj":
						return "在区间";
						break;
					case "qt":
						return "其它";
						break;
					default:
						return "未知";
						break;
				}
			},
			scoreItemCov: function(row) {
				switch(row.scoreItem) {
					case "cl":
						return "车龄";
						break;
					case "jccz":
						return "进厂差值";
						break;
					default:
						return "";
						break;
				}
			},
			// 问题项类型转换
			itemTypeCov:function(row){
				switch(row.itemType){
					case 'dx':
					return "单选";
					break;
					
					case 'ddx':
					return "多选";
					break;
					
					case 'wb':
					return "文本";
					break;
					
					default:
					return "未知";
					break;
				}
			}
		},
		created: function() {
			this.levelCombo(); // 获取下拉
			this.queryButton2(); // 获取编辑信息
		}
	}
</script>

<style>

</style>